<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>友情连接添加</title>
    <style>
        html, body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
        }

        .main {
            width: 100%;
            height: 100%;
            background: #fff;
        }
    </style>
    <!-- layui -->
    <link rel="stylesheet" href="/plugins/layui/css/layui.css"/>
</head>
<body>
<div class="main">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
        <#if friendshipLink == null>
            <legend>添加友情连接</legend>
        <#else>
            <legend>编辑友情连接</legend>
        </#if>
    </fieldset>
    <#if friendshipLink == null>
        <form class="layui-form layui-form-pane" action="/friendshiplink/add" method="post">
    <#else>
        <form class="layui-form layui-form-pane" action="/friendshiplink/update" method="post">
    </#if>
        <input type="hidden" name="flid" value="${friendshipLink.flid}"/>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">网站名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" value="${friendshipLink.name}" lay-verify="required" placeholder="请输入" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">友链网址</label>
                <div class="layui-input-inline">
                    <input type="text" name="url" value="${friendshipLink.url}" lay-verify="required" placeholder="请输入" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">排序(整数)</label>
                <div class="layui-input-inline">
                    <input type="text" name="sort" value="${friendshipLink.sort}" lay-verify="required" placeholder="请输入" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
        </div>


        <div class="layui-form-item">
            <button class="layui-btn" lay-submit="" lay-filter="friendshipLink-add">保存友链</button>
        </div>
    </form>
</div>
<!-- layui -->
<script src="/plugins/layui/layui.js"></script>
<script>
    layui.use(['jquery', 'form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        var $ = layui.jquery;

        form.on('submit(friendshipLink-add)', function (data) {
            console.log(data.field)
            return true;
        });
    });
</script>
</body>
</html>